/**
 * 初始化提现订单详情对话框
 */
var WithdrawOrderInfoDlg = {
    withdrawOrderInfoData : {}
};

/**
 * 清除数据
 */
WithdrawOrderInfoDlg.clearData = function() {
    this.withdrawOrderInfoData = {};
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
WithdrawOrderInfoDlg.set = function(key, val) {
    this.withdrawOrderInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
WithdrawOrderInfoDlg.get = function(key) {
    return $("#" + key).val();
}

/**
 * 关闭此对话框
 */
WithdrawOrderInfoDlg.close = function() {
    parent.layer.close(window.parent.WithdrawOrder.layerIndex);
}

/**
 * 收集数据
 */
WithdrawOrderInfoDlg.collectData = function() {
    this
    .set('id')
    .set('outTradeNo')
    .set('submitTime')
    .set('amount')
    .set('accountNo')
    .set('accountName')
    .set('accountType')
    .set('accountProp')
    .set('bankCode')
    .set('validate')
    .set('cvv2')
    .set('idType')
    .set('idNo')
    .set('tel')
    .set('province')
    .set('city')
    .set('custUserId')
    .set('summary')
    .set('remark')
    .set('settleDay')
    .set('status')
    .set('retCode')
    .set('errMsg')
    .set('finTime')
    .set('batchId')
    .set('chargeAmount')
    .set('realAmount')
    .set('receiveAmount')
    .set('createTime')
    .set('updateTime');
}

/**
 * 提交添加
 */
WithdrawOrderInfoDlg.addSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/withdrawOrder/add", function(data){
        Feng.success("添加成功!");
        window.parent.WithdrawOrder.table.refresh();
        WithdrawOrderInfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.withdrawOrderInfoData);
    ajax.start();
}

/**
 * 提交修改
 */
WithdrawOrderInfoDlg.editSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/withdrawOrder/update", function(data){
        Feng.success("修改成功!");
        window.parent.WithdrawOrder.table.refresh();
        WithdrawOrderInfoDlg.close();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.withdrawOrderInfoData);
    ajax.start();
}

$(function() {

});
